package com.atguigu.gulimall.order.service;

import com.alipay.api.AlipayApiException;
import com.atguigu.common.utils.PageUtils;
import com.atguigu.gulimall.order.entity.OrderEntity;
import com.atguigu.gulimall.order.vo.*;
import com.baomidou.mybatisplus.extension.service.IService;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author huguangwei
 * @email huguangwei@gmail.com
 * @date 2022-10-07 20:35:27
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    OrderConfimVo confirmOrder() throws ExecutionException, InterruptedException;

    SubmitOrderResponesVo submitOrder(OrderSubmitVo vo);

    OrderEntity getOrderByOrderSn(String orderSn);

    void closeOrder(OrderEntity entity);

    /**
     * 根据订单号获取支付订单信息
     *
     * @param orderSn
     * @return
     */
    PayVo getOrderPay(String orderSn);

    /**
     * 获取当前用户的订单和订单项
     *
     * @param params
     * @return
     */
    PageUtils queryPageWithItem(Map<String, Object> params);

    /**
     * 处理支付宝支付回调
     *
     * @param vo
     * @param request
     * @return
     */
    String handlePayResult(PayAsyncVo vo, HttpServletRequest request) throws AlipayApiException;
}

